package com.xxxx.server.controller;


import com.xxxx.server.pojo.Department;
import com.xxxx.server.pojo.ResBean;
import com.xxxx.server.service.IDepartmentService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoubin
 * @since 2021-11-13
 */
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService departmentService;
    /**
     * 查询所有部门
     * */
    @ApiOperation(value = "查询所有部门信息")
    @GetMapping("/")
    public List<Department> getDepartMent(){
        return departmentService.getDepartMent();
    }
    /**
     * 添加部门
     * */
    @ApiModelProperty(value="添加某部门")
    @PostMapping("/")
    public ResBean addDepartMent(Department department){
       return departmentService.addDept(department);
    }

    /**
     *  删除部门
     * */
    @ApiModelProperty(value="删除部门")
    @DeleteMapping("/{id}")
    public ResBean delDeptMent(@PathVariable Integer id){
        return departmentService.delDept(id);
    }
}
